package ai.plantdata.Creation.mode.SingletonPattern;

/**
 * @Author: WangHui
 * @Date: 2020/12/18 13:42
 * @Description:
 */
public class SingleObject {

    private static SingleObject instance;

    private SingleObject(){

    }

    public static synchronized SingleObject getInstance(){
        if(instance == null){
            return new SingleObject();
        }else {
            return instance;
        }
    }

    public void show(){
        System.out.println("hello world");
    }
}
